package com.qfedu.mapper;

import com.qfedu.model.Project;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author LiJH
 * @date 2023-02-08
 */
public interface ProjectMapper {
    @Select("select count(*) from project where status = 1")
    long count();
    @Select("select * from project where status=1 limit #{currentPage},#{pageSize} ")
    @Results(id = "projectMap",value = {
            //映射
            @Result(column = "pid",property = "pid"),
            @Result(column = "pname",property = "pname"),
            @Result(column = "starttime",property = "starttime"),
            @Result(column = "endtime",property = "endtime"),
            @Result(column = "did",property = "did"),
            //映射一对一
            @Result(column = "did",javaType = Deprecated.class,one = @One(select = "com.qfedu")),
            @Result(column = "pid",property = "pid"),
            @Result(column = "pid",property = "pid"),
    })
    List<Project> findPage(@Param("currentPage") int currentPage, @Param("pageSize") Integer pageSize);

}